import { config } from "./config";
import { TOYS_SHAPES } from "./toys_shapes";

const TILE_SIZE = 55

export class Model {
    static instance: Model = new Model();
    
    config;

    level_conf: number[][];
    toys_conf: {
        type: number,
        x: number,
        color: number,
    }[]

    constructor () {
        this.config = config;
        this.level_conf = config.level;
        this.toys_conf = config.toys;
    }

    getLevelConf() {
        return this.level_conf || [[]];
    }

    getToysConf() {
        return this.toys_conf || [];
    }

    getConfig () {
        return this.config;
    }

    getRows() {
        return this.level_conf.length;
    }

    getCols() {
        if (!this.level_conf || !this.level_conf.length) return 0;
        return this.level_conf[0].length;
    }

    getTileSize() {
        return TILE_SIZE;
    }

    getToyShapeConf() {
        return TOYS_SHAPES || [];
    }
}

export const model = Model.instance;